<?php

# mvblogs_2-0
# 2006 Oct 06  06:35:10
# frontend configurations

# define paths
define('FE_PATH' , dirname($_SERVER['SCRIPT_FILENAME']) . '/');
define('LIB_PATH', FE_PATH . 'lib/');
define('ETC_PATH', FE_PATH . 'etc/');
define('TPL_PATH', FE_PATH . 'tpl/');
define('TMP_PATH', FE_PATH . 'tmp/');

# define frontend constants
define('FE_STATE', 'dev'); # dev, prod
define('FE_DEBUG', false);
define('FE_DEBUG_IP', '202.1.207.231');
define('USER_PROFILE_VIEWS', (FE_STATE == 'prod') ? true : false);
define('USER_RANKING',       (FE_STATE == 'prod') ? true : false);
define('BLOG_RANKING',       (FE_STATE == 'prod') ? true : false);

# define frontend configuration directives
$CONFIG['db']['host'] = 'localhost';
$CONFIG['db']['port'] = '3307';
$CONFIG['db']['user'] = 'root';
$CONFIG['db']['pass'] = 'welcome';
$CONFIG['db']['base'] = 'bolheco_mvblogs';

# define frontend configuration variables
error_reporting(E_ALL);

# include required library files
require_once LIB_PATH . 'functions/printRHtml.php';
require_once LIB_PATH . 'functions/audit.php';
require_once LIB_PATH . 'functions/getDBConnection.php';

require_once LIB_PATH . 'classes/UsersModel.php';

require_once LIB_PATH . 'objects/SessionUser.php';
require_once LIB_PATH . 'objects/Request.php';

# initialize prerequisites
session_start();
$CONFIG['db']['conn'] = new mysqli(
    $CONFIG['db']['host'],
    $CONFIG['db']['user'],
    $CONFIG['db']['pass'],
    $CONFIG['db']['base'],
    $CONFIG['db']['port']);

$REQUEST = Request::getInstance();

if (isset($_SESSION['user']['hash'])
&& $_SESSION['user']['hash'] != 'b147085c5bf7126d231a3c8072774084') {
    SessionUser::initializeWithHash($_SESSION['user']['hash']);
} else {
    $_SESSION['user']['hash'] = 'b147085c5bf7126d231a3c8072774084';
    SessionUser::initialize(0);
}